import { APPROVAL_STATUS_SELECT_LIST } from '@/pages/supplier/constants/common'
import { getInitialFieldsValue, list2Obj } from '@/pages/supplier/utils'
const DOCUMENT_TYPE_SELECT_LIST = [
  { value: 21, label: '正常价格核查' },
  { value: 22, label: '临采价格核查' },
]
// 核查管理 - 核查审批跟进表
const FORM_ITEM_LIST = [
  { prop: 'supplierCode', label: '供应商代码', type: 'input', },
  { prop: 'supplierName', label: '供应商名称', type: 'input', },
  { prop: 'sponsor', label: '发起人', type: 'input', },
  { prop: 'launchTime', label: '发起时间', type: 'datePicker', },
  { prop: 'documentType', label: '单据类型', type: 'select', clearable: true, options: DOCUMENT_TYPE_SELECT_LIST },
  { prop: 'status', label: '审批状态', type: 'select', clearable: true, options: APPROVAL_STATUS_SELECT_LIST },
]
const INITIAL_FIELDS_VALUE = getInitialFieldsValue(FORM_ITEM_LIST)
const DOCUMENT_TYPE_MAP_OBJECT = list2Obj(DOCUMENT_TYPE_SELECT_LIST)
const APPROVAL_STATUS_MAP_OBJECT = list2Obj(APPROVAL_STATUS_SELECT_LIST)
const TABLE_COLUMNS = [
  { key: 'createUser', title: '发起人' },
  { key: 'createTime', title: '发起时间' },
  { key: 'supplierCode', title: '供应商代码' },
  { key: 'supplierName', title: '供应商名称' },
  { key: 'documentType',
    title: '单据类型',
    formatter: (row, columns, cellValue) => {
      return DOCUMENT_TYPE_MAP_OBJECT[cellValue]
    },
  },
  { key: 'status',
    title: '审批状态',
    formatter: (row, columns, cellValue) => {
      return APPROVAL_STATUS_MAP_OBJECT[cellValue]
    },
  },
]
export {
  INITIAL_FIELDS_VALUE,
  FORM_ITEM_LIST,
  TABLE_COLUMNS
}
